package com.example.syssoft.domain;

import com.example.syssoft.common.entities.LogicEntity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;

import javax.persistence.*;

@Entity
@Getter
@Setter
@Inheritance
@Where(clause = "is_deleted = 0")
@DiscriminatorColumn(name = "type")
@Table(name = "t_user")
@JsonIgnoreProperties(value = {"handler","hibernateLazyInitializer","fieldHandler"})
public abstract class User extends LogicEntity implements UserDetails {

    @Column
    @Schema(description = "账号")
    protected String username;

    @Column
    @Schema(description = "密码")
    protected String password;

    @Column(updatable = false, insertable = false)
    protected Integer type;
}
